package com.entites;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "EventGift")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "EventGift.findAll", query = "SELECT e FROM EventGift e"),
    @NamedQuery(name = "EventGift.findById", query = "SELECT e FROM EventGift e WHERE e.id = :id"),
    @NamedQuery(name = "EventGift.findByGiftType", query = "SELECT e FROM EventGift e WHERE e.giftType = :giftType"),
    @NamedQuery(name = "EventGift.findByGiftValue", query = "SELECT e FROM EventGift e WHERE e.giftValue = :giftValue")
})
public class EventGift implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "Id")
    private Integer id;
    @Size(max = 10)
    @Column(name = "GiftType")
    private String giftType;
    @Size(max = 100)
    @Column(name = "GiftValue")
    private String giftValue;
    @JoinColumn(name = "Username", referencedColumnName = "Username")
    @ManyToOne
    private Employee username;
    @JoinColumn(name = "EventId", referencedColumnName = "EventId")
    @ManyToOne(optional = false)
    private EventLibrary eventId;

    public EventGift()
    {
    }

    public EventGift(Integer id)
    {
        this.id = id;
    }

    public Integer getId()
    {
        return id;
    }

    public void setId(Integer id)
    {
        this.id = id;
    }

    public String getGiftType()
    {
        return giftType;
    }

    public void setGiftType(String giftType)
    {
        this.giftType = giftType;
    }

    public String getGiftValue()
    {
        return giftValue;
    }

    public void setGiftValue(String giftValue)
    {
        this.giftValue = giftValue;
    }

    public Employee getUsername()
    {
        return username;
    }

    public void setUsername(Employee username)
    {
        this.username = username;
    }

    public EventLibrary getEventId()
    {
        return eventId;
    }

    public void setEventId(EventLibrary eventId)
    {
        this.eventId = eventId;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EventGift))
        {
            return false;
        }
        EventGift other = (EventGift) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "com.entites.EventGift[ id=" + id + " ]";
    }

}
